import axios from '@/libs/request/axios'

// 通过渠道id查询渠道基本信息
export const getChannelBasicInfoById = (id, params) => {
    return axios.request({
        url: `/channel/channelOnline/getInfoById/${id}`,
        data: params,
        method: 'post'
    })
}
// 保存渠道基本信息
export const addChannel = (params) => {
    return axios.request({
        url: '/channel/channelOnline/saveOrUpdate',
        data: params,
        method: 'post'
    })
}


// 暂存渠道基本信息
export const addStagingChannel = (params) => {
    return axios.request({
        url: '/channel/channelOnline/saveOrUpdate',
        data: params,
        method: 'post'
    })
}

// 获取渠道数据 多条件
export const getChannelListData = (params) => {
    return axios.request({
        url: '/channel/channelOnline/getByCondition',
        data: params,
        method: 'post'
    })
}
// 地域查询数据列表
export const getByRegion = (params) => {
    return axios.request({
        url: '/channel/channelOnline/getByRegion',
        data: params,
        method: 'post'
    })
}
// 渠道发展查询数据列表
export const getByDevelop = (params) => {
    return axios.request({
        url: '/channel/channelOnline/getByDevelop',
        data: params,
        method: 'post'
    })
}
// 批量更换区域经理
export const batchManager = (params) => {
    return axios.request({
        url: '/channel/channelOnline/batchManager',
        data: params,
        method: 'post'
    })
}

// 删除渠道信息
export const deleteChannel = (ids, params) => {
    return axios.request({
        url: `/channel/channelOnline/delByIds/${ids}`,
        params: params,
        method: 'delete'
    })
}
// 通过渠道id查询风控信息
export const getChannelRiskInfoById = (id, params) => {
    return axios.request({
        url: `/channel/channelOnline/getRiskById/${id}`,
        data: params,
        method: 'post'
    })
}

// 通过渠道id查询保证金信息
export const getChannelQuotaInfoById = (id, params) => {
    return axios.request({
        url: `/channel/channelOnline/getQuotaInfoById/${id}`,
        data: params,
        method: 'post'
    })
}

// 多条件分页查询见证人信息列表
export const getWitnessListData = (params) => {
    return axios.request({
        url: '/channel/witness/getWitnessList',
        data: params,
        method: 'POST'
    })
}
//多条件查询挂靠信息
export const getAffiliationInfo = (params) => {
    return axios.request({
        url: '/channel/channelAffiliated/getChannelInfo',
        data: params,
        method: 'post'
    });
}
/**
 *新增黑名单
 * @param obj
 * @returns {*}
 */
export function saveBlack(obj) {
    return axios.request({
        url: '/channel/black/save',
        method: 'POST',
        data: obj
    })
}

/**
 *验证是否在黑名单信息库中
 * @param obj
 * @returns {*}
 */
export function blackCleack(obj) {
    return axios.request({
        url: '/channel/black/checkBlackOnline',
        method: 'POST',
        data: obj
    })
}

// 通过渠道id查询授权区域信息
export const getMainAreaById = (id, params) => {
    return axios.request({
        url: `/channel/channelOnline/getMainAreaById/${id}`,
        data: params,
        method: 'post'
    })
}

//渠道审批完成后逻辑处理
export const channelSubmit = (params) => {
    return axios.request({
        url: '/channel/channelOnline/channelSubmit',
        data: params,
        method: 'post'
    })
}

// 通过渠道id查询品牌信息
export const getCarBrandById = (id, params) => {
    return axios.request({
        url: `/channel/channelOnline/getMaiBrandById/${id}`,
        data: params,
        method: 'post'
    })
}
// 求改额度
export function upQuota(obj) {
    return axios.request({
        url: '/channel/channelQuota/upQuota',
        method: 'POST',
        data: obj
    })
}

// 通过渠道id查询授权车型
export const getVehicleById = (id, params) => {
    return axios.request({
        url: `/channel/channelOnline/getVehicleById/${id}`,
        data: params,
        method: 'post'
    })
}

// 获取渠道展区区域信息
export const getAreaListData = (params) => {
    return axios.request({
        url: '/channel/channelOnline/getAreaListCondition',
        data: params,
        method: 'post'
    })
}

// 多条件分页查询见证人信息列表
export const getArchivesLogInfoById = (params) => {
    return axios.request({
        url: '/channel/channelOnline/getArchivesLogInfo',
        data: params,
        method: 'POST'
    })
}

/**
 *验证统一社会信用代码是否重复
 * @param obj
 * @returns {*}
 */
export function socUniCrtCodeCheck(obj) {
    return axios.request({
        url: '/channel/channelOnline/socUniCrtCodeCheck',
        method: 'POST',
        data: obj
    })
}

//渠道审批完成后逻辑处理
export const channelSubmitWorkflow = (params) => {
    return axios.request({
        url: '/channel/channelOnline/channelSubmitWorkflow',
        data: params,
        method: 'post'
    })
}

// 已启动保存更新渠道基本信息
export const modifyChannel = (params) => {
    return axios.request({
        url: '/channel/channelOnline/modifyUpdate',
        data: params,
        method: 'post'
    })
}

//批量修改经纬度范围
export const saveModifyRange = (params) => {
    return axios.request({
        url: '/channel/channelOnline/modifyRange',
        data: params,
        method: 'post'
    })
}

//批量修改经纬度范围
export const saveModifyManager = (params) => {
    return axios.request({
        url: '/channel/channelOnline/modifyManager',
        data: params,
        method: 'post'
    })
}

//额度重算
export const recomputeQuota = (params) => {
    return axios.request({
        url: '/channel/channelQuota/recomputeQuota',
        data: params,
        method: 'post'
    })
}

// 获取渠道额度批量修改数据 多条件
export const getByConditionForBulkEditing = (params) => {
    return axios.request({
        url: '/channel/channelQuota/getByConditionForBulkEditing',
        data: params,
        method: 'post'
    })
}

// 通过渠道id查询授权车型（新车）
export const getNewVehicleById = (id, params) => {
    return axios.request({
        url: `/channel/channelOnline/getNewVehicleById/${id}`,
        data: params,
        method: 'post'
    })
}

// 通过渠道id查询授权车型（二手车）
export const getOldVehicleById = (id, params) => {
    return axios.request({
        url: `/channel/channelOnline/getOldVehicleById/${id}`,
        data: params,
        method: 'post'
    })
}

// 通过渠道id查询授权区域信息(新车)
export const getNewMainAreaById = (id, params) => {
    return axios.request({
        url: `/channel/channelOnline/getMainAreaById/${id}`,
        data: params,
        method: 'post'
    })
}

// 通过渠道id查询授权区域信息（二手车）
export const getOldMainAreaById = (id, params) => {
    return axios.request({
        url: `/channel/channelOnline/getMainAreaById/${id}`,
        data: params,
        method: 'post'
    })
}

// 获取渠道额度批量修改数据 多条件
export const afterArchive = (params) => {
    return axios.request({
        url: '/channel/channelOnline/afterArchive',
        data: params,
        method: 'post'
    })
}

// 通过统一社会信用代码查询渠道基本信息
export const getInfoBySocUniCrtCode = (socUniCrtCode, params) => {
    return axios.request({
        url: `/channel/channelOnline/getInfoBySocUniCrtCode/${socUniCrtCode}`,
        data: params,
        method: 'post'
    })
}
